// https://leetcode.cn/problems/longest-continuous-increasing-subsequence/
// Created by ade on 2022/8/11.
//        int ans = 0;
//        int n = nums.size();
//        int start = 0;
//        for (int i = 0; i < n; i++) {
//            if (i > 0 && nums[i] <= nums[i - 1]) {
//                start = i;
//            }
//            ans = max(ans, i - start + 1);
//        }
//        return ans;
//     {1, 3, 5, 4, 7, 8, 9,10}
//     {2, 2, -1, -2, 1, 1, 1};
#include <iostream>
#include <vector>


using namespace std;

class Solution {
public:
    // 最原始的方式
    int findLengthOfLCIS1(vector<int> &nums) {
        int start = 0;
        int res = 0;
        int len = nums.size();
        if (len < 2) return len;
        for (int i = 0; i < len - 1; i++) {
            res = max(res, i - start + 1);
            if (nums[i] >= nums[i + 1]) {
                start = i + 1;
            }
        }
        if (nums[len - 1] > nums[len - 2]) {
            res = max(res, len - start);
        }
        return res;
    }

    int findLengthOfLCIS(vector<int> &nums) {
        int start = 0;
        int res = 0;
        int len = nums.size();
        if (len < 2) return len;
        for (int i = 1; i < len; i++) {
            if (nums[i] > nums[i - 1]) {
                res = max(i - start + 1, res);
            } else {
                start = i;
            }
        }

        return res;
    }
};

int main() {
    Solution so;
//    vector<int> nums = {2, 1};
//    vector<int> nums = {1, 2};
    vector<int> nums = {1, 3, 5, 4, 7};

//    vector<int> nums = {2,2,2};
    auto res = so.findLengthOfLCIS(nums);
    cout << res << endl;
    return 0;
}